# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=squashfuse
pkgver=0.5.0
pkgrel=1
pkgdesc="FUSE filesystem to mount squashfs archives"
arch=(loong64 x86_64)
url="https://github.com/vasi/squashfuse"
license=(custom)
depends=(fuse zstd)
makedepends=()
source=(https://github.com/vasi/squashfuse/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('93ef7fc5d359d5a8faf284232bbf351ce5630de4234c9655445803030f7e1bc5')

prepare() {
  cd $pkgname-$pkgver
  ./autogen.sh
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  sed -e 's/ -shared / -Wl,-O1,--as-needed\0/g' -i libtool # Fix overlinking
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname

# install missing headers
  install -Dm644 *.h -t "$pkgdir"/usr/include/squashfuse
}
